﻿using DLLPC.PCAP;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VisionCore;

namespace COER
{
    public partial class UC_MotionStatus : UserControl
    {
        public UC_MotionStatus()
        {
            InitializeComponent();
        }

        public void Manual_Load()
        {
            axisDiagView1.Axis = Kernel.motion.CV1_Driver.axis;
            axisDiagView2.Axis = Kernel.motion.CV1_Y.axis;
            axisDiagView3.Axis = Kernel.motion.CV1_TrackSW_Y.axis;
            axisDiagView4.Axis = Kernel.motion.CV2_Driver.axis;
            axisDiagView5.Axis = Kernel.motion.CV2_Y.axis;
            axisDiagView6.Axis = Kernel.motion.CV2_TrackSW_Y.axis;
            axisDiagView7.Axis = Kernel.motion.CCD1_X.axis;
            axisDiagView8.Axis = Kernel.motion.CCD1_Y.axis;
            axisDiagView9.Axis = Kernel.motion.CCD1_Z.axis;
            axisDiagView10.Axis = Kernel.motion.CCD2_X.axis;
            axisDiagView11.Axis = Kernel.motion.CCD2_Y.axis;
            axisDiagView12.Axis = Kernel.motion.CCD2_Z.axis;
            axisDiagView13.Axis = Kernel.motion.Insp1_CV1.axis;
            axisDiagView26.Axis = Kernel.motion.Insp1_CV2.axis;
            axisDiagView14.Axis = Kernel.motion.Insp1_Y.axis;
            //axisDiagView15.Axis = Kernel.motion.Insp1_RM_Z.axis;
            axisDiagView16.Axis = Kernel.motion.Insp2_CV1.axis;
            axisDiagView17.Axis = Kernel.motion.Insp2_CV2.axis;
            axisDiagView18.Axis = Kernel.motion.Insp2_Y.axis;
            //axisDiagView19.Axis = Kernel.motion.Insp2_RM_Z.axis;
            axisDiagView20.Axis = Kernel.motion.Insp3_CV1.axis;
            axisDiagView27.Axis = Kernel.motion.Insp3_CV2.axis;
            axisDiagView21.Axis = Kernel.motion.Insp3_Y.axis;
            //axisDiagView22.Axis = Kernel.motion.Insp3_RM_Z.axis;
            axisDiagView24.Axis = Kernel.motion.Insp4_CV1.axis;
            axisDiagView23.Axis = Kernel.motion.Insp4_CV2.axis;
            axisDiagView28.Axis = Kernel.motion.Insp4_Y.axis;
            //axisDiagView25.Axis = Kernel.motion.Insp4_RM_Z.axis;
           

            aD_AxisCtrl1.SetAxis(Kernel.motion.CV1_Driver);
            aD_AxisCtrl2.SetAxis(Kernel.motion.CV1_Y);
            aD_AxisCtrl3.SetAxis(Kernel.motion.CV1_TrackSW_Y);
            aD_AxisCtrl4.SetAxis(Kernel.motion.CV2_Driver);
            aD_AxisCtrl5.SetAxis(Kernel.motion.CV2_Y);
            aD_AxisCtrl6.SetAxis(Kernel.motion.CV2_TrackSW_Y);
            aD_AxisCtrl7.SetAxis(Kernel.motion.CCD1_X);
            aD_AxisCtrl8.SetAxis(Kernel.motion.CCD1_Y);
            aD_AxisCtrl9.SetAxis(Kernel.motion.CCD1_Z);
            aD_AxisCtrl10.SetAxis(Kernel.motion.CCD2_X);
            aD_AxisCtrl11.SetAxis(Kernel.motion.CCD2_Y);
            aD_AxisCtrl12.SetAxis(Kernel.motion.CCD2_Z);
            aD_AxisCtrl13.SetAxis(Kernel.motion.Insp1_CV1);
            aD_AxisCtrl26.SetAxis(Kernel.motion.Insp1_CV2);
            aD_AxisCtrl14.SetAxis(Kernel.motion.Insp1_Y);
            //aD_AxisCtrl15.SetAxis(Kernel.motion.Insp1_RM_Z);
            aD_AxisCtrl16.SetAxis(Kernel.motion.Insp2_CV1);
            aD_AxisCtrl17.SetAxis(Kernel.motion.Insp2_CV2);
            aD_AxisCtrl18.SetAxis(Kernel.motion.Insp2_Y);
            //aD_AxisCtrl19.SetAxis(Kernel.motion.Insp2_RM_Z);
            aD_AxisCtrl20.SetAxis(Kernel.motion.Insp3_CV1);
            aD_AxisCtrl27.SetAxis(Kernel.motion.Insp3_CV2);
            aD_AxisCtrl21.SetAxis(Kernel.motion.Insp3_Y);
            //aD_AxisCtrl22.SetAxis(Kernel.motion.Insp3_RM_Z);
            aD_AxisCtrl24.SetAxis(Kernel.motion.Insp4_CV1);
            aD_AxisCtrl23.SetAxis(Kernel.motion.Insp4_CV2);
            aD_AxisCtrl28.SetAxis(Kernel.motion.Insp4_Y);
            //aD_AxisCtrl25.SetAxis(Kernel.motion.Insp4_RM_Z);

            //uC_PosSave1.SetAxis(Kernel.motion.CV1_Driver);
            uC_PosSave2.SetAxis(Kernel.motion.CV1_Y);
            uC_PosSave3.SetAxis(Kernel.motion.CV1_TrackSW_Y);
            //uC_PosSave4.SetAxis(Kernel.motion.CV2_Driver);
            uC_PosSave5.SetAxis(Kernel.motion.CV2_Y);
            uC_PosSave6.SetAxis(Kernel.motion.CV2_TrackSW_Y);
            uC_PosSave7.SetAxis(Kernel.motion.CCD1_X);
            uC_PosSave8.SetAxis(Kernel.motion.CCD1_Y);
            uC_PosSave9.SetAxis(Kernel.motion.CCD1_Z);
            uC_PosSave10.SetAxis(Kernel.motion.CCD2_X);
            uC_PosSave11.SetAxis(Kernel.motion.CCD2_Y);
            uC_PosSave12.SetAxis(Kernel.motion.CCD2_Z);
            //uC_PosSave13.SetAxis(Kernel.motion.Insp1_CV1);
            //uC_PosSave26.SetAxis(Kernel.motion.Insp1_CV2);
            uC_PosSave14.SetAxis(Kernel.motion.Insp1_Y);
            //uC_PosSave15.SetAxis(Kernel.motion.Insp1_RM_Z);
            //uC_PosSave16.SetAxis(Kernel.motion.Insp2_CV1);
            //uC_PosSave17.SetAxis(Kernel.motion.Insp2_CV2);
            uC_PosSave18.SetAxis(Kernel.motion.Insp2_Y);
            //uC_PosSave19.SetAxis(Kernel.motion.Insp2_RM_Z);
            //uC_PosSave20.SetAxis(Kernel.motion.Insp3_CV1);
            //uC_PosSave27.SetAxis(Kernel.motion.Insp3_CV2);
            uC_PosSave21.SetAxis(Kernel.motion.Insp3_Y);
            //uC_PosSave22.SetAxis(Kernel.motion.Insp3_RM_Z);
            //uC_PosSave24.SetAxis(Kernel.motion.Insp4_CV1);
            //uC_PosSave23.SetAxis(Kernel.motion.Insp4_CV2);
            uC_PosSave28.SetAxis(Kernel.motion.Insp4_Y);
            //uC_PosSave25.SetAxis(Kernel.motion.Insp4_RM_Z);

            #region
            aD_AxisCtrl1.OP = Kernel.OP;
            aD_AxisCtrl2.OP = Kernel.OP;
            aD_AxisCtrl3.OP = Kernel.OP;
            aD_AxisCtrl4.OP = Kernel.OP;
            aD_AxisCtrl5.OP = Kernel.OP;
            aD_AxisCtrl6.OP = Kernel.OP;
            aD_AxisCtrl7.OP = Kernel.OP;
            aD_AxisCtrl8.OP = Kernel.OP;
            aD_AxisCtrl9.OP = Kernel.OP;
            aD_AxisCtrl10.OP = Kernel.OP;
            aD_AxisCtrl11.OP = Kernel.OP;
            aD_AxisCtrl12.OP = Kernel.OP;
            aD_AxisCtrl13.OP = Kernel.OP;
            aD_AxisCtrl26.OP = Kernel.OP;
            aD_AxisCtrl14.OP = Kernel.OP;
            aD_AxisCtrl15.OP = Kernel.OP;
            aD_AxisCtrl16.OP = Kernel.OP;
            aD_AxisCtrl17.OP = Kernel.OP;
            aD_AxisCtrl18.OP = Kernel.OP;
            //aD_AxisCtrl19.OP = Kernel.OP;
            aD_AxisCtrl20.OP = Kernel.OP;
            aD_AxisCtrl27.OP = Kernel.OP;
            aD_AxisCtrl21.OP = Kernel.OP;
            aD_AxisCtrl22.OP = Kernel.OP;
            aD_AxisCtrl24.OP = Kernel.OP;
            aD_AxisCtrl23.OP = Kernel.OP;
            aD_AxisCtrl28.OP = Kernel.OP;
            aD_AxisCtrl25.OP = Kernel.OP;
           


            //aD_AxisCtrl1.HomeOccour += new EventHandler(Home1);
            aD_AxisCtrl2.HomeOccour += new EventHandler(Home2);
            aD_AxisCtrl3.HomeOccour += new EventHandler(Home3);
            //aD_AxisCtrl4.HomeOccour += new EventHandler(Home4);
            aD_AxisCtrl5.HomeOccour += new EventHandler(Home5);
            aD_AxisCtrl6.HomeOccour += new EventHandler(Home6);
            aD_AxisCtrl7.HomeOccour += new EventHandler(Home7);
            aD_AxisCtrl8.HomeOccour += new EventHandler(Home8);
            aD_AxisCtrl9.HomeOccour += new EventHandler(Home9);
            aD_AxisCtrl10.HomeOccour += new EventHandler(Home10);
            aD_AxisCtrl11.HomeOccour += new EventHandler(Home11);
            aD_AxisCtrl12.HomeOccour += new EventHandler(Home12);
            //aD_AxisCtrl13.HomeOccour += new EventHandler(Home13);
            //aD_AxisCtrl26.HomeOccour += new EventHandler(Home26);
            aD_AxisCtrl14.HomeOccour += new EventHandler(Home14);
            //aD_AxisCtrl15.HomeOccour += new EventHandler(Home15);
            //aD_AxisCtrl16.HomeOccour += new EventHandler(Home16);
            //aD_AxisCtrl17.HomeOccour += new EventHandler(Home17);
            aD_AxisCtrl18.HomeOccour += new EventHandler(Home18);
            //aD_AxisCtrl19.HomeOccour += new EventHandler(Home19);
            //aD_AxisCtrl20.HomeOccour += new EventHandler(Home20);
            //aD_AxisCtrl27.HomeOccour += new EventHandler(Home27);
            aD_AxisCtrl21.HomeOccour += new EventHandler(Home21);
            //aD_AxisCtrl22.HomeOccour += new EventHandler(Home22);
            //aD_AxisCtrl24.HomeOccour += new EventHandler(Home24);
            //aD_AxisCtrl23.HomeOccour += new EventHandler(Home23);
            aD_AxisCtrl28.HomeOccour += new EventHandler(Home28);
            //aD_AxisCtrl25.HomeOccour += new EventHandler(Home25);
          


            //uC_PosSave1.PosSaveEventHandler += new Action<double>(PosSave1);
            uC_PosSave2.PosSaveEventHandler += new Action<double>(PosSave2);
            uC_PosSave3.PosSaveEventHandler += new Action<double>(PosSave3);
            //uC_PosSave4.PosSaveEventHandler += new Action<double>(PosSave4);
            uC_PosSave5.PosSaveEventHandler += new Action<double>(PosSave5);
            uC_PosSave6.PosSaveEventHandler += new Action<double>(PosSave6);
            uC_PosSave7.PosSaveEventHandler += new Action<double>(PosSave7);
            uC_PosSave8.PosSaveEventHandler += new Action<double>(PosSave8);
            uC_PosSave9.PosSaveEventHandler += new Action<double>(PosSave9);
            uC_PosSave10.PosSaveEventHandler += new Action<double>(PosSave10);
            uC_PosSave11.PosSaveEventHandler += new Action<double>(PosSave11);
            uC_PosSave12.PosSaveEventHandler += new Action<double>(PosSave12);
            //uC_PosSave13.PosSaveEventHandler += new Action<double>(PosSave13);
            //uC_PosSave26.PosSaveEventHandler += new Action<double>(PosSave26);
            uC_PosSave14.PosSaveEventHandler += new Action<double>(PosSave14);
            uC_PosSave15.PosSaveEventHandler += new Action<double>(PosSave15);
            //uC_PosSave16.PosSaveEventHandler += new Action<double>(PosSave16);
            //uC_PosSave17.PosSaveEventHandler += new Action<double>(PosSave17);
            uC_PosSave18.PosSaveEventHandler += new Action<double>(PosSave18);
            //uC_PosSave19.PosSaveEventHandler += new Action<double>(PosSave19);
            //uC_PosSave20.PosSaveEventHandler += new Action<double>(PosSave20);
            //uC_PosSave27.PosSaveEventHandler += new Action<double>(PosSave27);
            uC_PosSave21.PosSaveEventHandler += new Action<double>(PosSave21);
            uC_PosSave22.PosSaveEventHandler += new Action<double>(PosSave22);
            //uC_PosSave24.PosSaveEventHandler += new Action<double>(PosSave24);
            //uC_PosSave23.PosSaveEventHandler += new Action<double>(PosSave23);
            uC_PosSave28.PosSaveEventHandler += new Action<double>(PosSave28);
            uC_PosSave25.PosSaveEventHandler += new Action<double>(PosSave25);
           
            //uC_PosSave1.OP = Kernel.OP;
            uC_PosSave2.OP = Kernel.OP;
            uC_PosSave3.OP = Kernel.OP;
            //uC_PosSave4.OP = Kernel.OP;
            uC_PosSave5.OP = Kernel.OP;
            uC_PosSave6.OP = Kernel.OP;
            uC_PosSave7.OP = Kernel.OP;
            uC_PosSave8.OP = Kernel.OP;
            uC_PosSave9.OP = Kernel.OP;
            uC_PosSave10.OP = Kernel.OP;
            uC_PosSave11.OP = Kernel.OP;
            uC_PosSave12.OP = Kernel.OP;
            //uC_PosSave13.OP = Kernel.OP;
            //uC_PosSave26.OP = Kernel.OP;
            uC_PosSave14.OP = Kernel.OP;
            uC_PosSave15.OP = Kernel.OP;
            //uC_PosSave16.OP = Kernel.OP;
            //uC_PosSave17.OP = Kernel.OP;
            uC_PosSave18.OP = Kernel.OP;
            //uC_PosSave19.OP = Kernel.OP;
            //uC_PosSave20.OP = Kernel.OP;
            //uC_PosSave27.OP = Kernel.OP;
            uC_PosSave21.OP = Kernel.OP;
            uC_PosSave22.OP = Kernel.OP;
            //uC_PosSave24.OP = Kernel.OP;
            //uC_PosSave23.OP = Kernel.OP;
            uC_PosSave28.OP = Kernel.OP;
            uC_PosSave25.OP = Kernel.OP;

            //AddButtonEvent(panel201.Controls);
            AddButtonEvent(panel202.Controls);
            AddButtonEvent(panel203.Controls);
            //AddButtonEvent(panel204.Controls);
            AddButtonEvent(panel205.Controls);
            AddButtonEvent(panel206.Controls);
            AddButtonEvent(panel207.Controls);
            AddButtonEvent(panel208.Controls);
            AddButtonEvent(panel209.Controls);
            AddButtonEvent(panel210.Controls);
            AddButtonEvent(panel211.Controls);
            AddButtonEvent(panel212.Controls);
            //AddButtonEvent(panel213.Controls);
            AddButtonEvent(panel214.Controls);
            AddButtonEvent(panel215.Controls);
            //AddButtonEvent(panel216.Controls);
            //AddButtonEvent(panel217.Controls);
            AddButtonEvent(panel218.Controls);
            //AddButtonEvent(panel219.Controls);
            //AddButtonEvent(panel220.Controls);
            AddButtonEvent(panel221.Controls);
            AddButtonEvent(panel222.Controls);
            //AddButtonEvent(panel223.Controls);
            //AddButtonEvent(panel224.Controls);
            AddButtonEvent(panel225.Controls);
            //AddButtonEvent(panel63.Controls);
            //AddButtonEvent(panel79.Controls);
            AddButtonEvent(panel87.Controls);

            #endregion
            timer1.Start();
        }

        private void AddButtonEvent(Control.ControlCollection ctrls)
        {
            foreach (Control item in ctrls)
            {
                if (item is Button && item.Tag?.ToString().Split('|')[0] == "btn")
                {
                    ((Button)item).Click += new EventHandler(this.btn_Switch_Click);
                }

                if (item is DLLPC.PCAP.PCButton && item.Tag?.ToString().Split('|')[0] == "btn")
                {
                    ((DLLPC.PCAP.PCButton)item).OP = Kernel.OP;
                }
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (this.Visible == false) return;

            #region InterLock
            //伺服页面 Servo off 及原点Enable
            aD_AxisCtrl1.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl2.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl3.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl4.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl5.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl6.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl7.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl8.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl9.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl10.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl11.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl12.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl13.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl26.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl14.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl15.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl16.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl17.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl18.InterLock = ProcedureHelper_EQ.ManualMode;
            //aD_AxisCtrl19.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl20.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl27.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl21.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl22.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl24.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl23.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl28.InterLock = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl25.InterLock = ProcedureHelper_EQ.ManualMode;
            
            //伺服页面Jog InterLock_P&&InterLock_N 功能使用：InterLockEable true：启用，false:禁用
            aD_AxisCtrl1.InterLockEable = true;
            aD_AxisCtrl2.InterLockEable = true;
            aD_AxisCtrl3.InterLockEable = true;
            aD_AxisCtrl4.InterLockEable = true;
            aD_AxisCtrl5.InterLockEable = true;
            aD_AxisCtrl6.InterLockEable = true;
            aD_AxisCtrl7.InterLockEable = true;
            aD_AxisCtrl8.InterLockEable = true;
            aD_AxisCtrl9.InterLockEable = true;
            aD_AxisCtrl10.InterLockEable = true;
            aD_AxisCtrl11.InterLockEable = true;
            aD_AxisCtrl12.InterLockEable = true;
            aD_AxisCtrl13.InterLockEable = true;
            aD_AxisCtrl26.InterLockEable = true;
            aD_AxisCtrl14.InterLockEable = true;
            aD_AxisCtrl15.InterLockEable = true;
            aD_AxisCtrl16.InterLockEable = true;
            aD_AxisCtrl17.InterLockEable = true;
            aD_AxisCtrl18.InterLockEable = true;
            //aD_AxisCtrl19.InterLockEable = true;
            aD_AxisCtrl20.InterLockEable = true;
            aD_AxisCtrl27.InterLockEable = true;
            aD_AxisCtrl21.InterLockEable = true;
            aD_AxisCtrl22.InterLockEable = true;
            aD_AxisCtrl24.InterLockEable = true;
            aD_AxisCtrl23.InterLockEable = true;
            aD_AxisCtrl28.InterLockEable = true;
            aD_AxisCtrl25.InterLockEable = true;
           

            //伺服手动Jog+Enable
            aD_AxisCtrl1.InterLock_P = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl2.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV1_Y_AllowMove;
            aD_AxisCtrl3.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV1_TrackSW_Y_AllowMove;
            aD_AxisCtrl4.InterLock_P = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl5.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV2_Y_AllowMove;
            aD_AxisCtrl6.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV2_TrackSW_Y_AllowMove;
            aD_AxisCtrl7.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD1_X_AllowMove;
            aD_AxisCtrl8.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD1_Y_AllowMove;
            aD_AxisCtrl9.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD1_Z_AllowMove;
            aD_AxisCtrl10.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD2_X_AllowMove;
            aD_AxisCtrl11.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD2_Y_AllowMove;
            aD_AxisCtrl12.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD2_Z_AllowMove;
            aD_AxisCtrl13.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl26.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl14.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp1_Y_AllowMove;
            aD_AxisCtrl15.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl16.InterLock_P = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl17.InterLock_P = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl18.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp2_Y_AllowMove;
            //aD_AxisCtrl19.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp2_RM_Z_AllowMove;
            aD_AxisCtrl20.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl27.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl21.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp3_Y_AllowMove;
            aD_AxisCtrl22.InterLock_P = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl24.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl23.InterLock_P = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl28.InterLock_P = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp4_Y_AllowMove;
            aD_AxisCtrl25.InterLock_P = ProcedureHelper_EQ.ManualMode;
        

            //伺服手动Jog-Enable
            aD_AxisCtrl1.InterLock_N = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl2.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV1_Y_AllowMove;
            aD_AxisCtrl3.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV1_TrackSW_Y_AllowMove;
            aD_AxisCtrl4.InterLock_N = ProcedureHelper_EQ.ManualMode;
            aD_AxisCtrl5.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV2_Y_AllowMove;
            aD_AxisCtrl6.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CV2_TrackSW_Y_AllowMove;
            aD_AxisCtrl7.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD1_X_AllowMove;
            aD_AxisCtrl8.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD1_Y_AllowMove;
            aD_AxisCtrl9.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD1_Z_AllowMove;
            aD_AxisCtrl10.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD2_X_AllowMove;
            aD_AxisCtrl11.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD2_Y_AllowMove;
            aD_AxisCtrl12.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.CCD2_Z_AllowMove;
            aD_AxisCtrl13.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl26.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl14.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp1_Y_AllowMove;
            aD_AxisCtrl15.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl16.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl17.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl18.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp2_Y_AllowMove;
            //aD_AxisCtrl19.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp2_RM_Z_AllowMove;
            aD_AxisCtrl20.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl27.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl21.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp3_Y_AllowMove;
            aD_AxisCtrl22.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl24.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl23.InterLock_N = ProcedureHelper_EQ.ManualMode ;
            aD_AxisCtrl28.InterLock_N = ProcedureHelper_EQ.ManualMode && ProcedureHelper_Exc.Insp4_Y_AllowMove;
            aD_AxisCtrl25.InterLock_N = ProcedureHelper_EQ.ManualMode ;


            //uC_PosSave1.InterLock = true;
            uC_PosSave2.InterLock = true;
            uC_PosSave3.InterLock = true;
            //uC_PosSave4.InterLock = true;
            uC_PosSave5.InterLock = true;
            uC_PosSave6.InterLock = true;
            uC_PosSave7.InterLock = true;
            uC_PosSave8.InterLock = true;
            uC_PosSave9.InterLock = true;
            uC_PosSave10.InterLock = true;
            uC_PosSave11.InterLock = true;
            uC_PosSave12.InterLock = true;
            //uC_PosSave13.InterLock = true;
            //uC_PosSave14.InterLock = true;
            uC_PosSave15.InterLock = true;
            //uC_PosSave16.InterLock = true;
            //uC_PosSave17.InterLock = true;
            uC_PosSave18.InterLock = true;
            //uC_PosSave19.InterLock = true;
            //uC_PosSave20.InterLock = true;
            uC_PosSave21.InterLock = true;
            uC_PosSave22.InterLock = true;
            //uC_PosSave23.InterLock = true;
            //uC_PosSave24.InterLock = true;
            uC_PosSave25.InterLock = true;
            //uC_PosSave26.InterLock = true;
            //uC_PosSave27.InterLock = true;
            uC_PosSave28.InterLock = true;
            #endregion

            #region 按钮显示
            btnCV1_Y01.Monitor(SaveIdx_CV1_Y == 1);
            btnCV1_Y02.Monitor(SaveIdx_CV1_Y == 2);
            btnCV1_TrackSW_Y01.Monitor(SaveIdx_CV1_TrackSW_Y == 1);
            btnCV1_TrackSW_Y02.Monitor(SaveIdx_CV1_TrackSW_Y == 2);
            btnCV1_TrackSW_Y03.Monitor(SaveIdx_CV1_TrackSW_Y == 3);
            btnCV1_TrackSW_Y04.Monitor(SaveIdx_CV1_TrackSW_Y == 4);
            btnCV2_Y01.Monitor(SaveIdx_CV2_Y == 1);
            btnCV2_Y02.Monitor(SaveIdx_CV2_Y == 2);
            btnCV2_TrackSW_Y01.Monitor(SaveIdx_CV2_TrackSW_Y == 1);
            btnCV2_TrackSW_Y02.Monitor(SaveIdx_CV2_TrackSW_Y == 2);
            btnCV2_TrackSW_Y03.Monitor(SaveIdx_CV2_TrackSW_Y == 3);
            btnCV2_TrackSW_Y04.Monitor(SaveIdx_CV2_TrackSW_Y == 4);
            btnCCD1_X01.Monitor(SaveIdx_CCD1_X == 1);
            btnCCD1_X03.Monitor(SaveIdx_CCD1_X == 3);
            btnCCD1_Y01.Monitor(SaveIdx_CCD1_Y == 1);
            btnCCD1_Y03.Monitor(SaveIdx_CCD1_Y == 3);
            btnCCD1_Z01.Monitor(SaveIdx_CCD1_Z == 1); 
            btnCCD1_Z03.Monitor(SaveIdx_CCD1_Z == 3);
            btnCCD2_X01.Monitor(SaveIdx_CCD2_X == 1);
            btnCCD2_X03.Monitor(SaveIdx_CCD2_X == 3);
            btnCCD2_Y01.Monitor(SaveIdx_CCD2_Y == 1);
            btnCCD2_Y03.Monitor(SaveIdx_CCD2_Y == 3);
            btnCCD2_Z01.Monitor(SaveIdx_CCD2_Z == 1);
            btnCCD2_Z03.Monitor(SaveIdx_CCD2_Z == 3);

            btnInsp1_Y01.Monitor(SaveIdx_Insp1_Y == 1);
            btnInsp1_Y02.Monitor(SaveIdx_Insp1_Y == 2);
            //btnInsp1_RM_Z01.Monitor(SaveIdx_Insp1_RM_Z == 1);
            //btnInsp1_RM_Z02.Monitor(SaveIdx_Insp1_RM_Z == 2);

            btnInsp2_Y01.Monitor(SaveIdx_Insp2_Y == 1);
            btnInsp2_Y02.Monitor(SaveIdx_Insp2_Y == 2);
            //btnInsp2_RM_Z01.Monitor(SaveIdx_Insp2_RM_Z == 1);
            //btnInsp2_RM_Z02.Monitor(SaveIdx_Insp2_RM_Z == 2);

            btnInsp3_Y01.Monitor(SaveIdx_Insp3_Y == 1);
            btnInsp3_Y02.Monitor(SaveIdx_Insp3_Y == 2);
            //btnInsp3_RM_Z01.Monitor(SaveIdx_Insp3_RM_Z == 1);
            //btnInsp3_RM_Z02.Monitor(SaveIdx_Insp3_RM_Z == 2);

            btnInsp4_Y01.Monitor(SaveIdx_Insp4_Y == 1);
            btnInsp4_Y02.Monitor(SaveIdx_Insp4_Y == 2);
            //btnInsp4_RM_Z01.Monitor(SaveIdx_Insp4_RM_Z == 1);
            //btnInsp4_RM_Z02.Monitor(SaveIdx_Insp4_RM_Z == 2);


            /*
              CV1_Y
              CV1_TrackSW_Y            
              CV2_Y)
              CV2_TrackSW_Y
              CCD1_X
              CCD1_Y
              CCD1_Z
              CCD2_X
              CCD2_Y
              CCD2_Z

              Insp1_Y
              Insp1_RM_Z                
              Insp2_Y
              Insp2_RM_Z                
              Insp3_Y
              Insp3_RM_Z               
              Insp4_Y
              Insp4_RM_Z
              */

            #endregion

            if (Kernel.motion.IsRun && Kernel.motion.IsRun)
            {
                aD_AxisIOStatus1.Refresh(Kernel.motion.CV1_Driver);
                aD_AxisIOStatus2.Refresh(Kernel.motion.CV1_Y);
                aD_AxisIOStatus3.Refresh(Kernel.motion.CV1_TrackSW_Y);
                aD_AxisIOStatus4.Refresh(Kernel.motion.CV2_Driver);
                aD_AxisIOStatus5.Refresh(Kernel.motion.CV2_Y);
                aD_AxisIOStatus6.Refresh(Kernel.motion.CV2_TrackSW_Y);
                aD_AxisIOStatus7.Refresh(Kernel.motion.CCD1_X);
                aD_AxisIOStatus8.Refresh(Kernel.motion.CCD1_Y);
                aD_AxisIOStatus9.Refresh(Kernel.motion.CCD1_Z);
                aD_AxisIOStatus10.Refresh(Kernel.motion.CCD2_X);
                aD_AxisIOStatus11.Refresh(Kernel.motion.CCD2_Y);
                aD_AxisIOStatus12.Refresh(Kernel.motion.CCD2_Z);
                aD_AxisIOStatus13.Refresh(Kernel.motion.Insp1_CV1);
                aD_AxisIOStatus26.Refresh(Kernel.motion.Insp1_CV2);
                aD_AxisIOStatus14.Refresh(Kernel.motion.Insp1_Y);
                //aD_AxisIOStatus15.Refresh(Kernel.motion.Insp1_RM_Z);
                aD_AxisIOStatus16.Refresh(Kernel.motion.Insp2_CV1);
                aD_AxisIOStatus17.Refresh(Kernel.motion.Insp2_CV2);
                aD_AxisIOStatus18.Refresh(Kernel.motion.Insp2_Y);
                //aD_AxisIOStatus19.Refresh(Kernel.motion.Insp2_RM_Z);
                aD_AxisIOStatus20.Refresh(Kernel.motion.Insp3_CV1);
                aD_AxisIOStatus27.Refresh(Kernel.motion.Insp3_CV2);
                aD_AxisIOStatus21.Refresh(Kernel.motion.Insp3_Y);
                //aD_AxisIOStatus22.Refresh(Kernel.motion.Insp3_RM_Z);
                aD_AxisIOStatus24.Refresh(Kernel.motion.Insp4_CV1);
                aD_AxisIOStatus23.Refresh(Kernel.motion.Insp4_CV2);
                aD_AxisIOStatus28.Refresh(Kernel.motion.Insp4_Y);
                //aD_AxisIOStatus25.Refresh(Kernel.motion.Insp4_RM_Z);


                //uC_PosSave1.Refresh(strExcST_Y);
                uC_PosSave2.Refresh(strCV1_Y);
                uC_PosSave3.Refresh(strCV1_TrackSW_Y);
                //uC_PosSave4.Refresh(strExcTR_X);
                uC_PosSave5.Refresh(strCV2_Y);
                uC_PosSave6.Refresh(strCV2_TrackSW_Y);
                uC_PosSave7.Refresh(strCCD1_X);
                uC_PosSave8.Refresh(strCCD1_Y);
                uC_PosSave9.Refresh(strCCD1_Z);
                uC_PosSave10.Refresh(strCCD2_X);
                uC_PosSave11.Refresh(strCCD2_Y);
                uC_PosSave12.Refresh(strCCD2_Z);
                //uC_PosSave13.Refresh(strLDTR_2_Z);
                uC_PosSave14.Refresh(strInsp1_Y);
                uC_PosSave15.Refresh(strInsp1_RM_Z);
                //uC_PosSave16.Refresh(strLaserST_R);
                //uC_PosSave17.Refresh(strLaserST_CCD1);
                uC_PosSave18.Refresh(strInsp2_Y);
                //uC_PosSave19.Refresh(strInsp2_RM_Z);
                //uC_PosSave20.Refresh(strULDTR_1_Z);
                uC_PosSave21.Refresh(strInsp3_Y);
                uC_PosSave22.Refresh(strInsp3_RM_Z);
                //uC_PosSave23.Refresh(strULDTR_2_Z);
                //uC_PosSave24.Refresh(strULDTR_2_R);
                uC_PosSave25.Refresh(strInsp4_RM_Z);
                //uC_PosSave26.Refresh(strULDST_X);
                //uC_PosSave27.Refresh(strULDST_Y);
                uC_PosSave28.Refresh(strInsp4_Y);


                //uC_PosSave1.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave2.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave3.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave4.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave5.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave6.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave7.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave8.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave9.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave10.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave11.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave12.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave13.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave14.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave15.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave16.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave17.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave18.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave19.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave20.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave21.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave22.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave23.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave24.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave25.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave26.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                //uC_PosSave27.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;
                uC_PosSave28.Enabled = Kernel.OP.Level > 0 && ProcedureHelper_EQ.ManualMode;

            }
            aD_AxisCtrl12.Speed = 1;
        }

     
        private int SaveIdx_CV1_Y = 1;       
        private int SaveIdx_CV2_Y = 1;
        private int SaveIdx_CV1_TrackSW_Y = 1;
        private int SaveIdx_CV2_TrackSW_Y = 1;
        private int SaveIdx_CCD1_X = 1;
        private int SaveIdx_CCD1_Y = 1;
        private int SaveIdx_CCD1_Z = 1;
        private int SaveIdx_CCD2_X = 1;
        private int SaveIdx_CCD2_Y = 1;
        private int SaveIdx_CCD2_Z = 1;
        private int SaveIdx_Insp1_Y = 1;
        private int SaveIdx_Insp1_RM_Z = 1;
        private int SaveIdx_Insp2_Y = 1;
        private int SaveIdx_Insp2_RM_Z = 1;
        private int SaveIdx_Insp3_Y = 1;
        private int SaveIdx_Insp3_RM_Z =1;
        private int SaveIdx_Insp4_Y = 1;
        private int SaveIdx_Insp4_RM_Z = 1;
    
        private string strCV1_Y= "等待位置";
        private string strCV1_TrackSW_Y = "等待位置";
        private string strCV2_Y = "等待位置";
        private string strCV2_TrackSW_Y= "等待位置";
        private string strCCD1_X= "等待位置";
        private string strCCD1_Y= "等待位置";
        private string strCCD1_Z = "等待位置";
        private string strCCD2_X = "等待位置";
        private string strCCD2_Y = "等待位置";
        private string strCCD2_Z = "等待位置";
        private string strInsp1_Y= "等待位置";
        private string strInsp1_RM_Z = "等待位置";
        private string strInsp2_Y= "等待位置";
        private string strInsp2_RM_Z = "等待位置";
        private string strInsp3_Y= "等待位置";
        private string strInsp3_RM_Z = "等待位置";
        private string strInsp4_Y= "载入位置";
        private string strInsp4_RM_Z= "载入位置";
        
       

        private void btn_Switch_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            string[] info = btn.Tag.ToString().Split('|');

            switch (info[1])
            {

                case "CV1_Y":
                    { 
                        switch (info[2])
                    {
                        case "01":
                            {
                                strCV1_Y = "等待位置";
                                SaveIdx_CV1_Y = 1;
                                uC_PosSave2.TarPos = ParameterHelper.CurParam.CV1_Y.Wait;
                            }
                            break;
                        case "02":
                            {
                                strCV1_Y = "夹持位置";
                                SaveIdx_CV1_Y = 2;
                                uC_PosSave2.TarPos = ParameterHelper.CurParam.CV1_Y.Work;
                                }
                            break;
                    }
                    }
                    break;
                case "CV1_TrackSW_Y":
                    { 
                        switch (info[2])
                    {
                        case "01":
                            {
                                strCV1_TrackSW_Y = "入料口1";
                                SaveIdx_CV1_TrackSW_Y = 1;
                                uC_PosSave3.TarPos = ParameterHelper.SysParam.CV1_TrackSW_Y.LDPt1;
                            }
                            break;
                        case "02":
                            {
                                strCV1_TrackSW_Y = "入料口2";
                                SaveIdx_CV1_TrackSW_Y = 2;
                                uC_PosSave3.TarPos = ParameterHelper.SysParam.CV1_TrackSW_Y.LDPt2;
                            }
                            break;
                        case "03":
                            {
                                strCV1_TrackSW_Y = "检测位置1";
                                SaveIdx_CV1_TrackSW_Y = 3;
                                uC_PosSave3.TarPos = ParameterHelper.SysParam.CV1_TrackSW_Y.Insp1;
                            }
                            break;
                        case "04":
                            {
                                strCV1_TrackSW_Y = "检测位置2";
                                SaveIdx_CV1_TrackSW_Y = 4;
                                uC_PosSave3.TarPos = ParameterHelper.SysParam.CV1_TrackSW_Y.Insp2;

                            }
                            break;
                        }
                    }
                    break;               
                case "CV2_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCV2_Y = "等待位置";
                                    SaveIdx_CV2_Y = 1;
                                    uC_PosSave5.TarPos = ParameterHelper.CurParam.CV2_Y.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strCV2_Y = "夹持位置";
                                    SaveIdx_CV2_Y = 2;
                                    uC_PosSave5.TarPos = ParameterHelper.CurParam.CV2_Y.Work;
                                }
                                break;
                          
                        }
                    }
                    break;
                case "CV2_TrackSW_Y":
                    { 
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCV2_TrackSW_Y = "入料口1";
                                    SaveIdx_CV2_TrackSW_Y = 1;
                                    uC_PosSave6.TarPos = ParameterHelper.SysParam.CV2_TrackSW_Y.LDPt1;
                                }
                                break;
                            case "02":
                                {
                                    strCV2_TrackSW_Y = "入料口1";
                                    SaveIdx_CV2_TrackSW_Y = 2;
                                    uC_PosSave6.TarPos = ParameterHelper.SysParam.CV2_TrackSW_Y.LDPt2;
                                }
                                break;
                            case "03":
                                {
                                    strCV2_TrackSW_Y = "检测位置1";
                                    SaveIdx_CV2_TrackSW_Y = 3;
                                    uC_PosSave6.TarPos = ParameterHelper.SysParam.CV2_TrackSW_Y.Insp1;
                                }
                                break;
                            case "04":
                                {
                                    strCV2_TrackSW_Y = "检测位置2";
                                    SaveIdx_CV2_TrackSW_Y = 4;
                                    uC_PosSave6.TarPos = ParameterHelper.SysParam.CV2_TrackSW_Y.Insp2;

                                }
                                break;
                        }
                    }
                    break;
                case "CCD1_X":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCCD1_X = "Insp1_CH1Mark位置";
                                    SaveIdx_CCD1_X = 1;
                                    uC_PosSave7.TarPos = ParameterHelper.CurParam.CCD1.CH1_Mark.CCD_X;
                                }
                                break;
                            case "02":
                                {
                                    strCCD1_X = "Insp1_CH1检测位置";
                                    SaveIdx_CCD1_X = 2;
                                    uC_PosSave7.TarPos = ParameterHelper.CurParam.CCD1.CH1_Insp.CCD_X;
                                }
                                break;
                            case "03":
                                {
                                    strCCD1_X = "Insp1_CH2Mark位置";
                                    SaveIdx_CCD1_X = 3;
                                    uC_PosSave7.TarPos = ParameterHelper.CurParam.CCD1.CH2_Mark.CCD_X;
                                }
                                break;
                            case "04":
                                {
                                    strCCD2_X = "Insp1_CH2检测位置";
                                    SaveIdx_CCD1_X = 4;
                                    uC_PosSave7.TarPos = ParameterHelper.CurParam.CCD1.CH2_Insp.CCD_X;
                                }
                                break;
                        }
                    }
                    break;
                case "CCD1_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCCD1_Y = "Insp1_CH1Mark位置";
                                    SaveIdx_CCD1_Y = 1;
                                    uC_PosSave8.TarPos = ParameterHelper.CurParam.CCD1.CH1_Mark.CCD_Y;
                                }
                                break;
                            case "02":
                                {
                                    strCCD1_Y = "Insp1_CH1检测位置";
                                    SaveIdx_CCD1_Y = 2;
                                    uC_PosSave8.TarPos = ParameterHelper.CurParam.CCD1.CH1_Insp.CCD_Y;
                                }
                                break;
                            case "03":
                                {
                                    strCCD1_Y = "Insp1_CH2Mark位置";
                                    SaveIdx_CCD1_Y = 3;
                                    uC_PosSave8.TarPos = ParameterHelper.CurParam.CCD1.CH2_Mark.CCD_Y;
                                }
                                break;
                            case "04":
                                {
                                    strCCD1_Y = "Insp1_CH2检测位置";
                                    SaveIdx_CCD1_Y = 4;
                                    uC_PosSave8.TarPos = ParameterHelper.CurParam.CCD1.CH2_Insp.CCD_Y;
                                }
                                break;
                        }
                    }
                    break;
                case "CCD1_Z":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCCD1_Z = "Insp1_CH1Mark位置";
                                    SaveIdx_CCD1_Z = 1;
                                    uC_PosSave9.TarPos = ParameterHelper.CurParam.CCD1.CH1_Mark.CCD_Z;
                                }
                                break;
                            case "02":
                                {
                                    strCCD1_Z = "Insp1_CH1检测位置";
                                    SaveIdx_CCD1_Z = 2;
                                    uC_PosSave9.TarPos = ParameterHelper.CurParam.CCD1.CH1_Insp.CCD_Z;
                                }
                                break;
                            case "03":
                                {
                                    strCCD1_Z = "Insp1_CH2Mark位置";
                                    SaveIdx_CCD1_Z = 3;
                                    uC_PosSave9.TarPos = ParameterHelper.CurParam.CCD1.CH2_Mark.CCD_Z;
                                }
                                break;
                            case "04":
                                {
                                    strCCD1_Z = "Insp1_CH2检测位置";
                                    SaveIdx_CCD1_Z = 4;
                                    uC_PosSave9.TarPos = ParameterHelper.CurParam.CCD1.CH2_Insp.CCD_Z;
                                }
                                break;
                        }
                    }
                    break;
                case "CCD2_X":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCCD2_X = "Insp2_CH1Mark位置";
                                    SaveIdx_CCD2_X = 1;
                                    uC_PosSave10.TarPos = ParameterHelper.CurParam.CCD2.CH1_Mark.CCD_X;
                                }
                                break;
                            case "02":
                                {
                                    strCCD2_X = "Insp2_CH1检测位置";
                                    SaveIdx_CCD2_X = 2;
                                    uC_PosSave10.TarPos = ParameterHelper.CurParam.CCD2.CH1_Insp.CCD_X;
                                }
                                break;
                            case "03":
                                {
                                    strCCD2_X = "Insp2_CH2Mark位置";
                                    SaveIdx_CCD2_X = 3;
                                    uC_PosSave10.TarPos = ParameterHelper.CurParam.CCD2.CH2_Mark.CCD_X;
                                }
                                break;
                            case "04":
                                {
                                    strCCD2_X = "Insp2_CH2检测位置";
                                    SaveIdx_CCD2_X = 4;
                                    uC_PosSave10.TarPos = ParameterHelper.CurParam.CCD2.CH2_Insp.CCD_X;
                                }
                                break;
                        }
                    }
                    break;
                case "CCD2_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCCD2_Y = "Insp2_CH1Mark位置";
                                    SaveIdx_CCD2_Y = 1;
                                    uC_PosSave11.TarPos = ParameterHelper.CurParam.CCD2.CH1_Mark.CCD_Y;
                                }
                                break;
                            case "02":
                                {
                                    strCCD2_Y = "Insp2_CH1检测位置";
                                    SaveIdx_CCD2_Y = 2;
                                    uC_PosSave11.TarPos = ParameterHelper.CurParam.CCD2.CH1_Insp.CCD_Y;
                                }
                                break;
                            case "03":
                                {
                                    strCCD2_Y = "Insp2_CH2Mark位置";
                                    SaveIdx_CCD2_Y = 3;
                                    uC_PosSave11.TarPos = ParameterHelper.CurParam.CCD2.CH2_Mark.CCD_Y;
                                }
                                break;
                            case "04":
                                {
                                    strCCD2_Y = "Insp2_CH2检测位置";
                                    SaveIdx_CCD2_Y = 4;
                                    uC_PosSave11.TarPos = ParameterHelper.CurParam.CCD2.CH2_Insp.CCD_Y;
                                }
                                break;
                        }
                    }
                    break;
                case "CCD2_Z":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strCCD2_Z = "Insp1_CH1Mark位置";
                                    SaveIdx_CCD2_Z = 1;
                                    uC_PosSave12.TarPos = ParameterHelper.CurParam.CCD2.CH1_Mark.CCD_Z;
                                }
                                break;
                            case "02":
                                {
                                    strCCD2_Z = "Insp1_CH1检测位置";
                                    SaveIdx_CCD2_Z = 2;
                                    uC_PosSave12.TarPos = ParameterHelper.CurParam.CCD2.CH1_Insp.CCD_Z;
                                }
                                break;
                            case "03":
                                {
                                    strCCD2_Z = "Insp1_CH2Mark位置";
                                    SaveIdx_CCD2_Z = 3;
                                    uC_PosSave12.TarPos = ParameterHelper.CurParam.CCD2.CH2_Mark.CCD_Z;
                                }
                                break;
                            case "04":
                                {
                                    strCCD2_Z = "Insp1_CH2检测位置";
                                    SaveIdx_CCD2_Z = 4;
                                    uC_PosSave12.TarPos = ParameterHelper.CurParam.CCD2.CH2_Insp.CCD_Z;
                                }
                                break;
                        }
                    }
                    break;              
                case "Insp1_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp1_Y = "等待位置";
                                    SaveIdx_Insp1_Y = 1;
                                    uC_PosSave14.TarPos = ParameterHelper.CurParam.Insp1_Y.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp1_Y = "夹持位置";
                                    SaveIdx_Insp1_Y = 2;
                                    uC_PosSave14.TarPos = ParameterHelper.CurParam.Insp1_Y.Work;
                                }
                                break;
                          
                        }
                    }
                    break;
                case "Insp1_RM_Z":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp1_RM_Z = "等待位置";
                                    SaveIdx_Insp1_RM_Z = 1;
                                    uC_PosSave15.TarPos = ParameterHelper.CurParam.Insp1_RM_Z.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp1_RM_Z = "顶升位置";
                                    SaveIdx_Insp1_RM_Z = 1;
                                    uC_PosSave15.TarPos = ParameterHelper.CurParam.Insp1_RM_Z.Work;
                                }
                                break;
                        }
                    }
                    break;
                case "Insp2_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp2_Y = "等待位置";
                                    SaveIdx_Insp2_Y = 1;
                                    uC_PosSave18.TarPos = ParameterHelper.CurParam.Insp2_Y.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp2_Y = "夹持位置";
                                    SaveIdx_Insp2_Y = 2;
                                    uC_PosSave18.TarPos = ParameterHelper.CurParam.Insp2_Y.Work;
                                }
                                break;

                        }
                    }
                    break;
                case "Insp2_RM_Z":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp2_RM_Z = "等待位置";
                                    SaveIdx_Insp2_RM_Z = 1;
                                    //uC_PosSave19.TarPos = ParameterHelper.CurParam.Insp2_RM_Z.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp2_RM_Z = "顶升位置";
                                    SaveIdx_Insp2_RM_Z = 1;
                                    //uC_PosSave19.TarPos = ParameterHelper.CurParam.Insp2_RM_Z.Work;
                                }
                                break;
                        }
                    }
                    break;
                case "Insp3_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp3_Y = "等待位置";
                                    SaveIdx_Insp3_Y = 1;
                                    uC_PosSave21.TarPos = ParameterHelper.CurParam.Insp3_Y.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp3_Y = "夹持位置";
                                    SaveIdx_Insp3_Y = 2;
                                    uC_PosSave21.TarPos = ParameterHelper.CurParam.Insp3_Y.Work;
                                }
                                break;
                        }
                    }
                    break;
                case "Insp3_RM_Z":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp3_RM_Z = "等待位置";
                                    SaveIdx_Insp3_RM_Z = 1;
                                    uC_PosSave22.TarPos = ParameterHelper.CurParam.Insp3_RM_Z.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp3_RM_Z = "顶升位置";
                                    SaveIdx_Insp3_RM_Z = 1;
                                    uC_PosSave22.TarPos = ParameterHelper.CurParam.Insp3_RM_Z.Work;
                                }
                                break;
                        }
                    }
                    break;
                case "Insp4_Y":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp4_Y = "等待位置";
                                    SaveIdx_Insp4_Y = 1;
                                    uC_PosSave28.TarPos = ParameterHelper.CurParam.Insp4_Y.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp4_Y = "夹持位置";
                                    SaveIdx_Insp4_Y = 2;
                                    uC_PosSave28.TarPos = ParameterHelper.CurParam.Insp4_Y.Work;
                                }
                                break;

                        }
                    }
                    break;
                case "Insp4_RM_Z":
                    {
                        switch (info[2])
                        {
                            case "01":
                                {
                                    strInsp4_RM_Z = "等待位置";
                                    SaveIdx_Insp4_RM_Z = 1;
                                    uC_PosSave25.TarPos = ParameterHelper.CurParam.Insp4_RM_Z.Wait;
                                }
                                break;
                            case "02":
                                {
                                    strInsp4_RM_Z = "顶升位置";
                                    SaveIdx_Insp4_RM_Z = 1;
                                    uC_PosSave25.TarPos = ParameterHelper.CurParam.Insp4_RM_Z.Work;
                                }
                                break;
                        }
                    }
                    break;

            }
        }

        #region 位置保存事件
        private void PosSave1(double pos)
        {
            switch (SaveIdx_CV1_Y)
            {
                case 1:
                    ParameterHelper.SysParam.ExcST.Load.Y = pos;
                    break;
                case 2:
                    ParameterHelper.SysParam.ExcST.Exchange.Y = pos;
                    break;                
            }
            if (SaveIdx_CV1_Y > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave2(double pos)
        {
            switch (SaveIdx_CV1_Y)
            {
                case 1:
                    ParameterHelper.CurParam.CV1_Y.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CV1_Y.Work = pos;
                    break;
                case 3:
                   
                    break;
            }
            if (SaveIdx_CV1_Y > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave3(double pos)
        {
            switch (SaveIdx_CV1_TrackSW_Y)
            {
                case 1:
                    {
                        ParameterHelper.SysParam.CV1_TrackSW_Y.LDPt1= pos;
                    }
                    break;
                case 2:
                    {
                        ParameterHelper.SysParam.CV1_TrackSW_Y.LDPt2 = pos;
                    }
                    break;
                case 3:
                    {
                        ParameterHelper.SysParam.CV1_TrackSW_Y.Insp1 = pos;
                    }
                    break;
                case 4:
                    {
                        ParameterHelper.SysParam.CV1_TrackSW_Y.Insp2 = pos;
                    }
                    break;
            }
            if (SaveIdx_CV1_TrackSW_Y > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave4(double pos)
        {
            
        }
        private void PosSave5(double pos)
        {
            switch (SaveIdx_CV2_Y)
            {
                case 1:
                    ParameterHelper.CurParam.CV2_Y.Wait = pos;
                    break;                
                case 2:
                    ParameterHelper.CurParam.CV2_Y.Work = pos;
                    break;
            }
            if (SaveIdx_CV2_Y > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave6(double pos)
        {
            switch (SaveIdx_CV2_TrackSW_Y)
            {
                case 1:
                    {
                        ParameterHelper.SysParam.CV2_TrackSW_Y.LDPt1 = pos;
                    }
                    break;
                case 2:
                    {
                        ParameterHelper.SysParam.CV2_TrackSW_Y.LDPt2 = pos;
                    }
                    break;
                case 3:
                    {
                        ParameterHelper.SysParam.CV2_TrackSW_Y.Insp1 = pos;
                    }
                    break;
                case 4:
                    {
                        ParameterHelper.SysParam.CV2_TrackSW_Y.Insp2 = pos;
                    }
                    break;
            }
            if (SaveIdx_CV2_TrackSW_Y > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave7(double pos)
        {
            switch (SaveIdx_CCD1_X)
            {
                case 1:
                    ParameterHelper.CurParam.CCD1.CH1_Mark.CCD_X = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CCD1.CH1_Insp.CCD_X = pos;
                    break;
                case 3:
                    ParameterHelper.CurParam.CCD1.CH2_Mark.CCD_X = pos;
                    break;
                case 4:
                    ParameterHelper.CurParam.CCD1.CH2_Insp.CCD_X = pos;
                    break;
            }
            if (SaveIdx_CCD1_X > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave8(double pos)
        {
            switch (SaveIdx_CCD1_Y)
            {
                case 1:
                    ParameterHelper.CurParam.CCD1.CH1_Mark.CCD_Y = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CCD1.CH1_Insp.CCD_Y = pos;
                    break;
                case 3:
                    ParameterHelper.CurParam.CCD1.CH2_Mark.CCD_Y = pos;
                    break;
                case 4:
                    ParameterHelper.CurParam.CCD1.CH2_Insp.CCD_Y = pos;
                    break;
            }
            if (SaveIdx_CCD1_Y > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave9(double pos)
        {
            switch (SaveIdx_CCD1_Z)
            {
                case 1:
                    ParameterHelper.CurParam.CCD1.CH1_Mark.CCD_Z = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CCD1.CH1_Insp.CCD_Z = pos;
                    break;
                case 3:
                    ParameterHelper.CurParam.CCD1.CH2_Mark.CCD_Z = pos;
                    break;
                case 4:
                    ParameterHelper.CurParam.CCD1.CH2_Insp.CCD_Z = pos;
                    break;
            }
            if (SaveIdx_CCD1_Z > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave10(double pos)
        {
            switch (SaveIdx_CCD2_X)
            {
                case 1:
                    ParameterHelper.CurParam.CCD2.CH1_Mark.CCD_X = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CCD2.CH1_Insp.CCD_X = pos;
                    break;
                case 3:
                    ParameterHelper.CurParam.CCD2.CH2_Mark.CCD_X = pos;
                    break;
                case 4:
                    ParameterHelper.CurParam.CCD2.CH2_Insp.CCD_X = pos;
                    break;
            }
            if (SaveIdx_CCD2_X > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave11(double pos)
        {
            switch (SaveIdx_CCD2_Y)
            {
                case 1:
                    ParameterHelper.CurParam.CCD2.CH1_Mark.CCD_Y = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CCD2.CH1_Insp.CCD_Y = pos;
                    break;
                case 3:
                    ParameterHelper.CurParam.CCD2.CH2_Mark.CCD_Y = pos;
                    break;
                case 4:
                    ParameterHelper.CurParam.CCD2.CH2_Insp.CCD_Y = pos;
                    break;
            }
            if (SaveIdx_CCD2_Y > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave12(double pos)
        {
            switch (SaveIdx_CCD2_Z)
            {
                case 1:
                    ParameterHelper.CurParam.CCD2.CH1_Mark.CCD_Z = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.CCD2.CH1_Insp.CCD_Z = pos;
                    break;
                case 3:
                    ParameterHelper.CurParam.CCD2.CH2_Mark.CCD_Z = pos;
                    break;
                case 4:
                    ParameterHelper.CurParam.CCD2.CH2_Insp.CCD_Z = pos;
                    break;
            }
            if (SaveIdx_CCD2_Z > 0)
            {
                ProcedureHelper_EQ.SaveSysParam();
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave13(double pos)
        {
           
        }
        private void PosSave14(double pos)
        {
            switch (SaveIdx_Insp1_Y)
            {
                case 1:
                    ParameterHelper.CurParam.Insp1_Y.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp1_Y.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp1_Y > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave15(double pos)
        {
            switch (SaveIdx_Insp1_RM_Z)
            {
                case 1:
                    ParameterHelper.CurParam.Insp1_RM_Z.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp1_RM_Z.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp1_RM_Z > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave16(double pos)
        {
            
        }
        private void PosSave17(double pos)
        {
            
        }
        private void PosSave18(double pos)
        {
            switch (SaveIdx_Insp2_Y)
            {
                case 1:
                    ParameterHelper.CurParam.Insp2_Y.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp2_Y.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp2_Y > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }            
        }
        private void PosSave19(double pos)
        {
            switch (SaveIdx_Insp2_RM_Z)
            {
                case 1:
                    ParameterHelper.CurParam.Insp2_RM_Z.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp2_RM_Z.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp2_RM_Z > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave20(double pos)
        {
            
        }
        private void PosSave21(double pos)
        {
            switch (SaveIdx_Insp3_Y)
            {
                case 1:
                    ParameterHelper.CurParam.Insp3_Y.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp3_Y.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp3_Y > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave22(double pos)
        {
            switch (SaveIdx_Insp3_RM_Z)
            {
                case 1:
                    ParameterHelper.CurParam.Insp3_RM_Z.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp3_RM_Z.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp3_RM_Z > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave23(double pos)
        {
            
        }
        private void PosSave24(double pos)
        {
          
        }
        private void PosSave25(double pos)
        {
            switch (SaveIdx_Insp4_RM_Z)
            {
                case 1:
                    ParameterHelper.CurParam.Insp4_RM_Z.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp4_RM_Z.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp4_RM_Z > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave28(double pos)
        {
            switch (SaveIdx_Insp4_Y)
            {
                case 1:
                    ParameterHelper.CurParam.Insp4_Y.Wait = pos;
                    break;
                case 2:
                    ParameterHelper.CurParam.Insp4_Y.Work = pos;
                    break;
                case 3:

                    break;
            }
            if (SaveIdx_Insp4_Y > 0)
            {
                ProcedureHelper_EQ.SaveRecParam();
                ProcedureHelper_EQ.RecGridRefresh = true;
            }
        }
        private void PosSave27(double pos)
        {
          
        }      
        private void PosSave29(double pos)
        {
           
        }
        private void PosSave30(double pos)
        {
           
        }
        private void PosSave32(double pos)
        {
           
        }
        private void PosSave31(double pos)
        {
        }
        #endregion

        #region 回原点事件
        /// <summary>
        /// CV1驱动
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home1(object obj, EventArgs e)
        {
            //if (!ProcedureHelper_Exc.ExcST_AllowMove)
            //{
            //    string str = "请确认";
            //    if (ProcedureHelper_Exc.ExcST_Down)
            //    {
            //        str = str + "平台Pin";
            //    }

            //    if (ProcedureHelper_Exc.Exc_Up)
            //    {
            //        str = str + "&&压膜";
            //    }

            //    if (ProcedureHelper_Exc.Exc_MS_Up)
            //    {
            //        str = str + "&&压膜量测";
            //    }

            //    str = str + "气缸状态是否正常？";
            //    MessageBox.Show(str, "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            //}
            //else
            //{
            //    Kernel.motion.ExcST_Y.HomeStart = true;
            //}
        }
        /// <summary>
        /// CV1定位Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home2(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CV1_Y_AllowMove)
            {
                string str = "请确认";
                str = str + "门是否锁好？CV上是否还有物料？";
                MessageBox.Show(str, "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CV1_Y.HomeStart = true;
            }
        }
        /// <summary>
        /// CV1轨道切换Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home3(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CV1_TrackSW_Y_AllowMove)
            {
                string str = "门是否锁好？请确认CV1入口以及出口位置无基板！";               
                MessageBox.Show(str, "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CV1_TrackSW_Y.HomeStart = true;
            }
           
        }
        /// <summary>
        /// CV2驱动
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home4(object obj, EventArgs e)
        {
            //if (!ProcedureHelper_Exc.ExcTR_X_AllowMove)
            //{
            //    MessageBox.Show("请确认倒膜移载旋转轴&&升降轴&&压膜模组&&压膜量测&&挑拣平台Y轴是否在安全位？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            //}
            //else
            //{
            //    Kernel.motion.ExcTR_X.HomeStart = true;
            //}
        }
        /// <summary>
        /// CV2定位Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home5(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CV2_Y_AllowMove)
            {
                string str = "请确认";
                str = str + "门是否锁好？CV上是否还有物料？";
                MessageBox.Show(str, "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CV2_Y.HomeStart = true;
            }
        }
        /// <summary>
        /// CV2轨道切换Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home6(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CV2_TrackSW_Y_AllowMove)
            {
                string str = "请确认";
                str = str + "门是否锁好？CV上是否还有物料？";

                MessageBox.Show(str, "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CV2_TrackSW_Y.HomeStart = true;
            }
        }
        /// <summary>
        /// CCD1_X轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home7(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CCD1_X_AllowMove)
            {

                MessageBox.Show("请确认X轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CCD1_X.HomeStart = true;
            }
        }
        /// <summary>
        /// CCD1_Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home8(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CCD1_Y_AllowMove)
            {
                MessageBox.Show("请确认Y轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CCD1_Y.HomeStart = true;
            }
        }
        /// <summary>
        /// CCD1_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home9(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CCD1_Z_AllowMove)
            {
                MessageBox.Show("请确认Z轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CCD1_Z.HomeStart = true;
            }
        }
        /// <summary>
        /// CCD2_X轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home10(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CCD2_X_AllowMove)
            {

                MessageBox.Show("请确认X轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CCD2_X.HomeStart = true;
            }                
        }
        /// <summary>
        /// CCD2_Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home11(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CCD2_Y_AllowMove)
            {
                MessageBox.Show("请确认Y轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CCD2_Y.HomeStart = true;
            }
        }
        /// <summary>
        /// CCD2_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home12(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.CCD2_Z_AllowMove)
            {
                MessageBox.Show("请确认Z轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.CCD2_Z.HomeStart = true;
            }
        }
        /// <summary>
        /// Insp1_CV1驱动
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home13(object obj, EventArgs e)
        {
            //Kernel.motion.LDTR_2_Z.HomeStart = true;
        }
        /// <summary>
        /// Insp1_Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home14(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.Insp1_Y_AllowMove)
            {
                MessageBox.Show("请确认载入移载2 Z轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.Insp1_Y.HomeStart = true;
            }
        }
        /// <summary>
        /// Insp1_RM_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home15(object obj, EventArgs e)
        {
            Kernel.motion.CCD_1.HomeStart = true;
        }
        private void Home16(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.LaserST_R_AllowMove)
            {
                MessageBox.Show("请确认载入移载及载出移载 Z轴&&镭射平台测量气缸是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.LaserST_R.HomeStart = true;
            }
        }
        private void Home17(object obj, EventArgs e)
        {
            Kernel.motion.CCD_2.HomeStart = true;
        }
        /// <summary>
        /// Insp2_Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home18(object obj, EventArgs e)
        {
            Kernel.motion.Insp2_Y.HomeStart = true;
        }
        /// <summary>
        /// Insp2_RM_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home19(object obj, EventArgs e)
        {
            Kernel.motion.CCD_4.HomeStart = true;
        }
        /// <summary>
        /// ULDTR_1_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home20(object obj, EventArgs e)
        {
            Kernel.motion.ULDTR_1_Z.HomeStart = true;
        }
        /// <summary>
        /// Insp3_Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home21(object obj, EventArgs e)
        {
                Kernel.motion.Insp3_Y.HomeStart = true;
           
        }
        /// <summary>
        /// Insp3_RM_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home22(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.ULDTR_R_AllowMove)
            {
                MessageBox.Show("请确认载出移载1&&2 Z轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.ULDTR_R.HomeStart = true;
            }
        }
        /// <summary>
        /// ULDTR_2_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home23(object obj, EventArgs e)
        {
            Kernel.motion.ULDTR_2_Z.HomeStart = true;
        }
        /// <summary>
        /// ULDTR_2_R轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home24(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.ULDTR_2_R_AllowMove)
            {
                MessageBox.Show("请确认载出移载2 Z轴是否回原点和在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.ULDTR_2_R.HomeStart = true;
            }
        }
        /// <summary>
        /// Insp4_RM_Z轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home25(object obj, EventArgs e)
        {
            Kernel.motion.CCD_5.HomeStart = true;
        }
        private void Home26(object obj, EventArgs e)
        {
            if (!ProcedureHelper_Exc.ULDST_X_AllowMove)
            {
                MessageBox.Show("请确认载出移载 Z轴&&载出平台Y轴&&载出平台推拉轴是否在安全位？门是否锁好？", "询问", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                Kernel.motion.ULDST_X.HomeStart = true;
            }
        }
        private void Home27(object obj, EventArgs e)
        {
            Kernel.motion.ULDST_Y.HomeStart = true;
        }
        /// <summary>
        /// Insp4_Y轴
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Home28(object obj, EventArgs e)
        {
            Kernel.motion.Insp4_Y.HomeStart = true;
        }
        private void Home29(object obj, EventArgs e)
        {
            Kernel.motion.CCD_6.HomeStart = true;
        }
        private void Home30(object obj, EventArgs e)
        {
            Kernel.motion.Efem_X.HomeStart = true;
        }
        private void Home32(object obj, EventArgs e)
        {
           
                Kernel.motion.ULDPort_Z_L.HomeStart = true;
           
        }
        private void Home31(object obj, EventArgs e)
        {
          
                Kernel.motion.ULDPort_Z_R.HomeStart = true;
           
        }
        #endregion
    }
}
